Why not revise the pull-ups have a clean PS proper freewheeling diodes for the relays and so on
what means this? external pull ups and then ... power supply something...?

sorry, my english is not so fine ;-)