Fixes some errors in code