added exception catching for empty posted data