fix but when null passed to post/put, refactored post methods