less hacky solution to #9