Added preference tests and fixed a bug