Fixing some code issues