fixing issues with the code