added conditional for magic quotes