Improved return when error occurs