added error checking to assignments