Some bugs fixes, need bricks revision