get_3x3 function improved