Fix for compilation on edf site
fix a bug with the condition when adding a user and when selcting the correct user
simplify SQL command construction