SPL bug fixes

Review commit by commit