fixed bugs in lab1.R w/ adam