Fixed malloc error with bricks