Added error check.