Added error catching to prevent server from crashing on bad requests