Fixed error handling..