more error checking and fixed day view