fixed sign flip bug