improved the way unauthorised access errors are handled on the server