fix some issues with casting

NOT WORKING
add stacktrace info
add assemble support to fem