Added log and fixed bug for exceptional cases not_found and forbidden