fixing a bug in application logic