Fixed error code bug