fixed minor bug (I should start scaping all the sql queries :-/)