Moved error checking so it doesn't fail :(?