added exception handling in post