#144 SQL fixed