Moved exception handling from internal REST. Fixed returning NULL when handler on specific level does not exist.
Moved session end to the correct place.