modified if statment in dispatch