fixed some events and uglified code