Fixed server crash due to client-only code being run on the server