Added error checking for gets