added some error messages
fixed merge issue