improve source handling