fix bug with ending and not def catch