reorder condition for better performance