working solution without using hack