Fix error code bug