working on fixing error checking