fixed module binary handling, code cleanup