added magic quotes support