Fixed some bug. Added a block test