Error fixing

Fixed some errors, program now works