Cleans up compiler warnings with casting