fixed register function

function checks if user already exists