Fixed some block handling bugs. Added some console prints for debug purposes. They will be removed later.