Fix #58 and 52