added prefix option and removed a bug