some error improvements