got rid of nasty static casts