Add spec and fix implementation by adding missing parameter to where clause