added in missing code which caused errors