added some error statements