Added unit tests
lastTick nullpointerexception fixed