implemented hasOne and added more tests