Updated readme and fixed a potential bug