Fixed bug with overwritten subjects, and added spec tests