Weird behavior with matrix keypads

Hi folks, I need to use two membrane 4x4 matrix keypads to input a code (it's a home security alarm, I put the two keypads in different rooms to enter the code) and I thought to connect them in parallel to Arduino Mega using the same 8 I/O pins. I am using keypad library. However, if I connect one keypad at a time everything works fine, but if I connect both of them in parallel, both behave weird: it seems that the firs row is always activated, i.e. if I press row 2 col 4 I get row 1 col 4 few times, and row 2 col 4 few other times... column is correct but row is most of the times always 1...

any ideas on what is going on?

Thanks in advance

Cyberto

It would seem like you have not wired them correctly or the keypads have some active elements in them that stops you wiring them like this.