pinMode execution time?

if i get you right, the you have a direct connection between the buttons and the keys, thus pressing a button sends a signal regardless of the pinmode. so this cannot work. get yourself some shift registers to increase the pincount.