modified handling of invalid request method