Fixed various errors