some bugs corrected
+ Added some error messages