fixes #16, please review the code if the security is still guarantied