fixed defect from unit testing and added another unit test for AJAX call