prevent multiple instances and fixed some weird errors that magically
appeared even though this thing ran fine yesterday