quick and ugly fix to onended event