Added error codes
Fixed modify user permissions not sticking