Fixed basic bugs