Some common bugs fixed