fixed some bugs
added timer events handling