Fixed typecast issues for server