Fix keys controller error codes and some server side details