Added check for invalid physics calculations