cuda implemented, but with bugs