fixed incorrect syntax on related() with conditions