add test and error check