fixed some coding errors