cleanups and add robustness against dummy data