Added some type (char) casting
Removed a wrong cast to (long) of a Tick type variable