fixxed reduce if else error