fixed the bug, works both ways encryption and decryption