fixed some errors in code