cleaned up err response and added checks