Fixed issues in existing code