Added error check for blocks