wrong direction comparison bugfix