Fixed errors and code style